<%@ Control Language="C#" AutoEventWireup="false" Inherits="CVCommunity.Admin.Filter"%>
<%@ Register tagPrefix="forum" namespace="CVCommunity.Provider" assembly="CVCommunity.Provider"%>
<script src="../scripts/common.js"></script>
<form runat="server" onsubmit="return checknumber()">
<div class="grid">
<table width="100%" cellspacing="0" class="inner" style="font-size:12px;">
<tr class="forumno category" style="font-size:14px;">
<td width="645" colspan="53">过滤器</td>
</tr>
<tr class="forumtd">
<td colspan="2"><a href="?action=filter&operation=add">&rsaquo;&rsaquo;&nbsp;添加过滤器</a>&nbsp;&nbsp;&nbsp;<a href="?action=filter&operation=list">&rsaquo;&rsaquo;&nbsp;过滤器列表</a></td>
</tr>
<tr class="forumtd">
  <td colspan="5" align="left">
  <asp:Panel ID="ListFilterPanel" runat="server"  Visible="false">
  <table width="100%" border="0" cellspacing="2" cellpadding="2"> 
  <tr>
    <td colspan="3"><strong>过滤器列表</strong></td>
  </tr>
  <tr>
    <td width="45%">过滤器名称</td>
    <td width="15%">全局状态</td>
    <td width="40%">操作</td>
  </tr>
  <asp:Repeater ID="list" runat="server">
  <itemtemplate>
  <tr>
    <td><forum:span id="name" runat="server" /></td>
    <td><forum:span id="status" runat="server" /></td>
    <td><forum:anchor id="edit" text="编辑" runat="server" /> | <forum:anchor id="delete" text="删除" runat="server" onclick="return confirm('确定要删除吗')"/></td>
  </tr>
  </itemtemplate>
  </asp:Repeater>  
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  </table>
  </asp:Panel>
  <asp:Panel ID="AddFilterPanel" runat="server" Visible="false">
    <table width="100%" border="0" cellspacing="2" cellpadding="2">
      <tr>
        <td><strong><asp:Label ID="labelAdd" Text="添加过滤器" runat="server" Visible="false" /><asp:Label ID="labelEdit" Text="编辑过滤器" runat="server" Visible="false" /></strong></td>
      </tr>
      <tr>
        <td width="545">过滤器名称 <asp:TextBox ID="Name" runat="server" size="30" /></td>
      </tr>
      <tr>
        <td class="smallbox"><input type="checkbox" name="Enabled" value="1" />
        启用全局</td>
      </tr>
      <tr>
        <td class="smallbox"><p>满足如下条件</p>
          <p>
            <input name="CondictionType" type="radio" value="0" checked="checked" />
            满足其中之一
            <input name="CondictionType" type="radio" value="1" />
            全部满足</p></td>
      </tr>
      <tr>
        <td><span class="smallbox">
          <input type="checkbox" name="Condiction" value="1" />
        </span> 如果标题
        <select name="Op1">
          <option value="0">包含</option>
          <option value="1">不包含</option>
          <option value="2">匹配</option>
        </select>
        <input name="Keyword1" type="text" size="50" value="他妈|操你妈|法轮功" />
        (多个用“|”分割)</td>
      </tr>
      <tr>
        <td><span class="smallbox">
          <input type="checkbox" name="Condiction" value="2"/>
        </span> 如果内容
        <select name="Op2">
          <option value="0">包含</option>
          <option value="1">不包含</option>
          <option value="2">匹配</option>
        </select>
        <input name="Keyword2" type="text" size="50" value="他妈|操你妈|法轮功" />
        (多个用“|”分割)</td>
      </tr>
      <tr>
        <td><span class="smallbox">
          <input type="checkbox" name="Condiction" value="4" />
        </span> 如果IP段
        <select name="Op4">
          <option value="0">处于</option>
          <option value="1">不处于</option>
        </select>
        <input name="BeginIp" type="text" value="127.0.0.1" />
        -
        <input name="EndIp" type="text" value="127.0.0.10" />
        之间 (格式：“127.0.0.1”)</td>
      </tr>
      <tr>
        <td><span class="smallbox">
          <input type="checkbox" name="Condiction" value="8" />
        </span> 如果发帖时间
        <select name="Op8">
          <option value="0">在</option>
          <option value="1">不在</option>
        </select>
        每日的
        <input name="BeginTime" type="text" size="10" value="02:00" />
-
<input name="EndTime" type="text"  size="10" value="05:00" />
之间 (格式：“HH-mm”)</td>
      </tr>
      
      <tr>
        <td><span class="smallbox">
          <input type="checkbox" name="Condiction" value="16" />
        </span> 如果内容包含关键字
        <input name="Keywords" type="text" size="50" value="他妈|操你妈|法轮功"/>
        (多个以“|”分割)
        <input name="Count" type="text" size="5" value="1" alt="numeric"/>
        个或更多</td>
      </tr>
      <tr>
        <td><span class="smallbox">
          <input type="checkbox" name="Condiction" value="32" />
        </span> 如果用户
        <select name="CreditType">
          <%=CreditTypeOption%>
        </select>
低于
<input name="Require" type="text" size="5" value="0" alt="numeric" /></td>
      </tr>
      <tr>
        <td>则执行如下操作</td>
      </tr>
      <tr>
        <td>
		  <p class="smallbox">
            <input type="radio" name="Result" value="1" checked="checked" />
            待审核		  </p>
          <p class="smallbox">
            <input type="radio" name="Result" value="2" />
            不发表          </p>
          <p class="smallbox">
            <input type="radio" name="Result" value="3" />
            发表并锁定该主题</p>
          <p class="smallbox">
            <input type="radio" name="Result" value="4" />
            锁定用户并强迫下线</p>
          <p class="smallbox">
            <input type="radio" name="Result" value="5" />
			删除用户</p>
          <p>&nbsp;</p></td>
      </tr>
      <tr>
        <td>提示信息：          
          <input name="Prompt" type="text" size="50" value="所发内容无法通过过滤器"/></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
    </table>    
    <p>
	<asp:Button ID="btnAdd" Text="创建过滤器" runat="server" CssClass="button" OnClick="AddFilter" Visible="false"/>
	<asp:Button ID="btnEdit" Text="确定修改" runat="server" CssClass="button" OnClick="EditFilter" Visible="false"/>
	</p>
	</asp:Panel>	</td>
</tr>
</table>
</div>
</form>
<script>
function initControl()
{
	if (undefined(form().Result)) return;
	var f = form();
	
	checkradiobyvalue(f.Result, Result);
	checkradiobyvalue(f.CondictionType, CondictionType);
	f.Enabled.checked = Enabled;
	if ((Condiction & 1) != 0)  checkradiobyvalue(f.Condiction, '1');
	if ((Condiction & 2) != 0)  checkradiobyvalue(f.Condiction, '2');
	if ((Condiction & 4) != 0)  checkradiobyvalue(f.Condiction, '4');
	if ((Condiction & 8) != 0)  checkradiobyvalue(f.Condiction, '8');
	if ((Condiction & 16) != 0)  checkradiobyvalue(f.Condiction, '16');
	if ((Condiction & 32) != 0)  checkradiobyvalue(f.Condiction, '32');
	f.Prompt.value = Prompt;
	 
	checkbyvalue(f.Op1, Op1);
	checkbyvalue(f.Op2, Op2);
	checkbyvalue(f.Op4, Op4);
	checkbyvalue(f.Op8, Op8);
	checkbyvalue(f.CreditType, CreditType);
	f.Keyword1.value = Keyword1;
	f.Keyword2.value = Keyword2;
	f.Keywords.value = Keywords;	
	f.BeginIp.value = BeginIp;
	f.EndIp.value = EndIp;
	f.BeginTime.value = BeginTime;
	f.EndTime.value = EndTime;
	f.Count.value = Count;
	f.Require.value = Require;
}
initControl();
</script>